/*
	Copyright 2007-2010 Petr Ohlidal

	This file is a part of GrobMaker

	GrobMaker is free software: you can redistribute it and/or modify
	it under the terms of the GNU General Public License as published by
	the Free Software Foundation, either version 3 of the License, or
	(at your option) any later version.

	GrobMaker is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU General Public License for more details.

	You should have received a copy of the GNU General Public License
	along with GrobMaker.  If not, see <http://www.gnu.org/licenses/>.
*/

#ifndef GROBMAKER_FILELIST
#define GROBMAKER_FILELIST

/** @file */

#include "FileInfo.hpp"
#include <list>

namespace GrobMaker{

class FileList: public std::list<FileInfo>{

public:

	/**
	* Lists files in given dir. Ignores the "." and ".." files.
	* @return Number of files in the dir, or -1 if there was an error.
	*/
	static int listDir(const fs::path& dirName, std::list<FileInfo>& files);

	/**
	 * Returns true if the first argument goes before the second argument
	 */
	static bool sortFileInfoByIndex( const FileInfo& a, const FileInfo& b );

	static std::string fileListToString(std::list<FileInfo>& files, std::string bullet, std::string separator);

	/**
	 * Removes all files whose name doesn't contain numeric index.
	 * @return Number of files removed
	 */
	static int removeUnindexed(std::list<FileInfo>& files);

	static int removeNonImageFiles(std::list<FileInfo>& files);
};

} // namespace GrobMaker

#endif //#ifndef GROBMAKER_FILELIST
